/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sgt.onlinetest.hibernatedao;

import java.util.List;
import org.hibernate.Session;
import org.hibernate.criterion.Expression;
import sgt.onlinetest.entity.Question;
import sgt.onlinetest.entity.QuestionCategory;

/**
 *
 * @author Administrator
 */
public class HibernateQuestionDAO extends HibernateGenericDAO<Question, Long> {

    public HibernateQuestionDAO(Session session) {
        super(session);
    }

    public List<Question> getByCategory(QuestionCategory category) {
        return getSession().createCriteria(Question.class).add(Expression.eq("category.autoId", category.getAutoId())).list();
    }
}
